Amber's Digital Garden

Access World Settings from Blueprint

A simple Unreal C++ function to access World Settings from Blueprint


There is no built-in function to access World Settings from blueprint. You have to make your own function in a library like so:

// .h
UFUNCTION(BlueprintPure, Category="Utility", meta = (WorldContext = "WorldContextObject"))  
static AWorldSettings* GetWorldSettings(const UObject* WorldContextObject);
// .cpp
AWorldSettings* UFunctionLibrary::GetWorldSettings(const UObject* WorldContextObject)  
{  
    return WorldContextObject->GetWorld()->GetWorldSettings();  
}

by amber